﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Linq.Expressions;
using System.Data;
using System.Data.Common;

namespace Hotnet.Dal.BaseRepository
{
	public interface IRepository<T> where T:class
	{
		T Get(int id);
		T GetBy(Expression<Func<T, bool>> where);

		void Delete(int id);
		void Delete(T target);
		void DeleteBy(Expression<Func<T, Boolean>> where);

		T[] List();
		T[] ListBy(Expression<Func<T, bool>> where);

		//void UpdateExcludeGenerateKey(T model);
		void Update(T model);
		void Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> evaluator);
		void Update(IQueryable<T> entities, Expression<Func<T, T>> evaluator);
		void Update(int pkID, Expression<Func<T, T>> evaluator);
		void UpdateSelfDefine(T model, bool isUpdateNull, bool isUpdateZero);

		void Insert(T target);
		T[] List<TKey>(Expression<Func<T, TKey>> keySelector, bool Descending);

	}
}
